﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wimm.Common.Entities;
using Wimm.Common.Entities.Utils;
using Wimm.Common.Interfaces.Utils;

namespace Wimm.Common.Entities.Utils
{
    /// <summary>
    /// Class witch provides method for getting new items from ViewModel to CustomDataGrid
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class PagingFunctionSource<DalClass, CurClass>
    {
        public Func<IPagedRequest<DalClass>, Task<IPagedResult<CurClass>>> Function;

        public PagingFunctionSource(Func<IPagedRequest<DalClass>, Task<IPagedResult<CurClass>>> function)
        {
            Function = function;
        }

        public async Task<IPagedResult<CurClass>> NextPage(IPagedRequest<DalClass> s)
        {
            return await Function(s);
        }
    }
}
